﻿<cfscript>

/** 
* Security Frameworks - logoutFilter
* 
* @extends "MachII.framework.EventFilter"
* 
* @displayname "acadmicManager.filters.security.logoutFilter" 
* @hint "Security Frameworks - logoutFilter" 
* 
* @Output false
* 
* @depends "securityAdvice, sessionAdvice, casAdvice, tagLocationHelper, tagHeaderHelper"
*/ 

component {
	
	/*
	* @hint "Configures this filter as part of the Mach-II framework" 
	*/
	public void function configure() output=false {} 
	
	/*
	* @hint "Filters event and returns a boolean to Mach-II indicating whether or not the event queue should proceed.  If not, the event queue is cleared and a new event is announced."
	* 
	* @event "MachII Event Object"
	* @eventContext "MachII EventContext Object"
	*/
	public boolean function filterEvent ( required MachII.framework.Event event, required MachII.framework.EventContext eventContext ) output=false {
		
		var casAdvice = getcasAdvice();
		var sessionAdvicer = getsessionAdvice();
		
		var router = gettagLocationHelper();
		var header = gettagHeaderHelper();
		
		/* 从当前应用注销会话 */
		sessionAdvicer.logout();
		
		var _redirectURL = casAdvice.getLogoutURL();
				
		/* 将用户重定向到服务页面 */
		header.noCache();
				
		router.redirect( urlAddress=_redirectURL, statusCode=301 );
		
		return false;
	}
	
}

</cfscript>